import java.util.Scanner;

public class Solution {
    static String b = "";
    public static boolean isZhishu(int n){
        int b = (int)Math.sqrt(n);
        if(n==2)
            return false;
        for(int i=2; i<=b;i++){
            if(n%i==0)
                return false;
        }
        return true;
    }
    public static int ZhishuPairs(int n){
        int result = 0;
        for(int i=1; i<=n/2; i++){
            if(isZhishu(i)&&isZhishu(n-i)){
                result++;
            }
        }
        return result;
    }
    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = ZhishuPairs(a);
        System.out.println(b);
    }

}

